#include <stdio.h>

int countDigitSum(int target) {
    int result = 0;
    while (target != 0) {
        result += target % 10;
        target /= 10;
    }
    return result;
}

int main() {
    int target;
    scanf("%d", &target);
    int result = 0;
    while (target != 0) {
        target -= countDigitSum(target);
        result++;
    }
    printf("%d", result);
}